package com.qumitech.visualnovel.service.basic.impl;

import com.qumitech.visualnovel.controller.vo.basic.StartChannelBasicStatisticsDataVO;

import com.qumitech.visualnovel.datasource.console.StartChannelBasicDataMapper;
import com.qumitech.visualnovel.service.basic.StartChannelBasicStatisticsDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @Author :  ZhChNing
 * @Descriptiom :
 * @Date Created in 2019/3/12 16:19
 */

@Service
public class StartChannelBasicStatisticsDataServiceImpl implements StartChannelBasicStatisticsDataService {


    @Autowired
    StartChannelBasicDataMapper startChannelBasicDataMapper;

    @Override
    public List<StartChannelBasicStatisticsDataVO> listBasicStatisticsData(String appChannel, String startTime, String endTime, Integer offset, Integer limit) {
        List<StartChannelBasicStatisticsDataVO> startChannelBasicDataList = startChannelBasicDataMapper.listBasicStatisticsData(appChannel, startTime, endTime, offset, limit);
        for(StartChannelBasicStatisticsDataVO startChannelBasicData: startChannelBasicDataList){
            startChannelBasicData.calculateRegisterRate();
        }
        return startChannelBasicDataList;
    }

    @Override
    public Integer getCount(String appChannel, String startTime, String endTime, Integer offset, Integer limit) {
        return startChannelBasicDataMapper.getCount(appChannel,startTime,endTime,offset,limit);
    }
}
